import Vue from 'vue'
import App from './App.vue'
import store from './store'
import router from './router'
import './plugins/iview.js'


import {common} from './assets/js/common.js';
import axiosMd from '@/assets/js/interfaceClass';
import token from './plugins/token.js';
import QS from 'qs'

Vue.prototype.$common = common;
Vue.prototype.$axios = axiosMd;
Vue.prototype.$token = token;
Vue.prototype.$QS = QS;
// token.setUUID('18232532031')

Vue.config.productionTip = false

Vue.filter('format', (e) => {
    return format(e)
})

function add0(m) {
    return m < 10 ? '0' + m : m
}

function format(shijianchuo) {
    let time = new Date(shijianchuo);
    let y = time.getFullYear();
    let m = time.getMonth() + 1;
    let d = time.getDate();
    return y + '-' + add0(m) + '-' + add0(d);
}
router.beforeEach((to,from,next)=>{
    if(JSON.stringify(to.meta) != "{}"){
        store.commit('modifybreadCrumbs',{
            breadCrumbsName1:to.meta.breadCrumbsName[0],
            breadCrumbsName2:to.meta.breadCrumbsName[1],
            href:to.meta.breadCrumbsHref
        })
    }else{
        store.commit('modifybreadCrumbs',{
            breadCrumbsName1:''
        })
    }
    
    next();

  })
let app = new Vue({
    store,
    router,
    render: h => h(App)
}).$mount('#app')
export default app
